package com.ruoyi.course.service.impl;

import java.util.List;
        import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.course.domain.CourseWareComment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.course.mapper.CourseWareMapper;
import com.ruoyi.course.domain.CourseWare;
import com.ruoyi.course.service.ICourseWareService;

/**
 * 培训课件Service业务层处理
 *
 * @author zzx
 * @date 2023-03-29
 */
@Service
public class CourseWareServiceImpl implements ICourseWareService {
    @Autowired
    private CourseWareMapper courseWareMapper;

    /**
     * 查询培训课件
     *
     * @param id 培训课件主键
     * @return 培训课件
     */
    @Override
    public CourseWare selectCourseWareById(Long id) {
        return courseWareMapper.selectCourseWareById(id);
    }

    /**
     * 查询培训课件列表
     *
     * @param courseWare 培训课件
     * @return 培训课件
     */
    @Override
    public List<CourseWare> selectCourseWareList(CourseWare courseWare) {
        return courseWareMapper.selectCourseWareList(courseWare);
    }

    /**
     * 新增培训课件
     *
     * @param courseWare 培训课件
     * @return 结果
     */
    @Override
    public int insertCourseWare(CourseWare courseWare) {
                courseWare.setCreateTime(DateUtils.getNowDate());
            return courseWareMapper.insertCourseWare(courseWare);
    }

    /**
     * 修改培训课件
     *
     * @param courseWare 培训课件
     * @return 结果
     */
    @Override
    public int updateCourseWare(CourseWare courseWare) {
        return courseWareMapper.updateCourseWare(courseWare);
    }

    /**
     * 批量删除培训课件
     *
     * @param ids 需要删除的培训课件主键
     * @return 结果
     */
    @Override
    public int deleteCourseWareByIds(Long[] ids) {
        return courseWareMapper.deleteCourseWareByIds(ids);
    }

    /**
     * 删除培训课件信息
     *
     * @param id 培训课件主键
     * @return 结果
     */
    @Override
    public int deleteCourseWareById(Long id) {
        return courseWareMapper.deleteCourseWareById(id);
    }

    @Override
    public int insertWareQuestion(Long wareId, Long questionId) {
        return courseWareMapper.insertWareQuestion(wareId,questionId);
    }

    @Override
    public int deleteCourseWareQuestion(Long wareId, Long questionId) {
        return courseWareMapper.deleteCourseWareQuestion(wareId,questionId);
    }

    @Override
    public int insertWareComment(CourseWareComment courseWareComment) {
        return courseWareMapper.insertCourseWareComment(courseWareComment);
    }

    @Override
    public int deleteCourseWareComment(Long id) {
        return courseWareMapper.deleteCourseWareComment(id);
    }

    @Override
    public int selectCourseWareCountByTrainId(Long trainId) {
        return courseWareMapper.selectCourseWareCountByTrainId(trainId);
    }

    @Override
    public int updateWatchCountAdd(Long wareId) {
        return courseWareMapper.updateWatchCountAdd(wareId);
    }
}
